//-----------------------------------------------------------------------
// <copyright file="CapacityService.cs" company="FetCo">
//     Copyright (c) FetCo. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using FetCo.Framework;
using ADESSA.Entities;
using ADESSA.Data;
    
namespace ADESSA.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class CapacityService
    {
        #region Capacity

        public static void CreateCapacity(Capacity capacity)
        {            
            try
            {
                CapacityDAO capacityDAO = new CapacityDAO();
                capacityDAO.CreateCapacity(capacity);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreateCapacityException, ex);
            }
        }        

        public static void UpdateCapacity(Capacity capacity)
        {            
            try
            {
                CapacityDAO capacityDAO = new CapacityDAO();
                capacityDAO.UpdateCapacity(capacity);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdateCapacityException, ex);
            }
        }        

        public static void DeleteCapacity(int capacityID)
        {            
            try
            {
                CapacityDAO capacityDAO = new CapacityDAO();
                capacityDAO.DeleteCapacity(capacityID);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeleteCapacityException, ex);
            }
        }
        
        public static Capacity GetCapacity(int capacityID)
        {            
            try
            {
                CapacityDAO capacityDAO = new CapacityDAO();
                return capacityDAO.GetCapacity(capacityID);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCapacityException, ex);
            }
        }                

        public static CapacityCollection GetCapacityList(CapacityColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                CapacityDAO capacityDAO = new CapacityDAO();
                return capacityDAO.GetCapacityList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCapacityListException, ex);
            }
        }        

        public static CapacityCollection GetCapacityList(CapacityColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                CapacityDAO capacityDAO = new CapacityDAO();
                return capacityDAO.GetCapacityList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCapacityListException, ex);
            }
        }        

	    public static CapacityCollection GetCapacityListByParam(object orderBy, OrderDirection orderDirection,string where)
        {            
            try
            {
                CapacityDAO capacityDAO = new CapacityDAO();
                return capacityDAO.GetCapacityListByParam(orderBy, orderDirection,where);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCapacityListException, ex);
            }
        }        

        public static CapacityCollection GetCapacityListByParam(object orderBy, OrderDirection orderDirection, int page, int pageSize,string Criteria, out int totalRecords)
        {            
            try
            {
                CapacityDAO capacityDAO = new CapacityDAO();
                return capacityDAO.GetCapacityListByParam(orderBy, orderDirection, page, pageSize,Criteria, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCapacityListException, ex);
            }
        }        

        #endregion
    }
}